package com.gzhryc.shared_device.iot.code.dao.db;

import com.gzhryc.jdbc.annotaion.Column;
import com.gzhryc.jdbc.annotaion.Id;
import com.gzhryc.jdbc.annotaion.Table;
import com.gzhryc.shared_device.iot.core.enums.EIOTType;
import com.gzhryc.shared_device.iot.code.dao.enums.IOTServerNodeEnum;

import java.io.Serializable;
import java.util.Date;

/**
 * IOT服务节点
 * 
 * @author zhanghao
 *
 */
@Table(name = "iot_server_node")
public class IOTServerNode implements Serializable {

	@Id(auto = false)
	protected Long id;

	@Column(length = 64, notNull = true, note = "节点名称")
	protected String name;

	@Column(name = "protocol_type", notNull = true, note = "协议类型")
	protected String protocolType;

	@Column(name = "iot_type", notNull = true, defVal = "1", note = "节点类型")
	protected Integer iotType;

	@Column(name = "product_key", notNull = true, note = "产品KEY，节点标识符")
	protected String productKey;

	@Column(name = "api_url", length = 255, note = "API访问路径")
	protected String apiUrl;

	@Column(name = "api_token", length = 64, note = "API访问令牌")
	protected String apiToken;

	@Column(name = "api_sign", length = 64, note = "API签名码")
	protected String apiSign;

	@Column(name = "link_config", type = "text", note = "节点配置信息")
	protected String linkConfig;

	@Column(length = 4, notNull = true, defVal = "1", note = "状态")
	protected Integer state;

	@Column(name = "update_date", autoUpdateTime = true)
	protected Date updateDate;

	@Column(name = "create_date", note = "创建时间")
	protected Date createDate;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getProtocolType() {
		return protocolType;
	}

	public void setProtocolType(String protocolType) {
		this.protocolType = protocolType;
	}

	public Integer getIotType() {
		return iotType;
	}

	public void setIotType(Integer iotType) {
		this.iotType = iotType;
	}

	public String getProductKey() {
		return productKey;
	}

	public void setProductKey(String productKey) {
		this.productKey = productKey;
	}

	public String getApiUrl() {
		return apiUrl;
	}

	public void setApiUrl(String apiUrl) {
		this.apiUrl = apiUrl;
	}

	public String getApiToken() {
		return apiToken;
	}

	public void setApiToken(String apiToken) {
		this.apiToken = apiToken;
	}

	public String getApiSign() {
		return apiSign;
	}

	public void setApiSign(String apiSign) {
		this.apiSign = apiSign;
	}

	public String getLinkConfig() {
		return linkConfig;
	}

	public void setLinkConfig(String linkConfig) {
		this.linkConfig = linkConfig;
	}

	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getIotTypeName() {
		return EIOTType.note(this.iotType);
	}

	public String getStateName() {
		return IOTServerNodeEnum.State.note(this.state);
	}
}
